#include<iostream>
#include<string>
using namespace std;
const int N = 1e6 + 10;
int b,a[N],c[N];
int main()
{
	string s1;cin >> s1 >> b;
	int la = s1.size();
	for (int i = 0; i < la; i++)
	{
		a[i] = s1[la - i - 1] - '0';
	}
	int t = 0;
	for (int i = la - 1; i >= 0; i--)
	{
		t = t * 10 + a[i];
		c[i] = t / b;
		t %= b;
	}
	while (c[la - 1] == 0 && la > 1) la--;
	for (int i = la - 1; i >= 0; i--)
	{
		cout << c[i];
	}
	return 0;
}